/*************************************************************************************
*                                  SRL ENGINE                                        *
*                                                                                    *
*                                                                                    *
*  File : SRL_Texture.h                                                              *
*  Author: SRL Killing                                                               *
*  Date: 25/02/10 20:30                                                              *
*  Description:                                                                      *
*                                                                                    *  
*  Licence :  LGPL                                                                   *
*                                                                                    *
*    Copyright (C) 2010 Pecatte Baptiste                                             *
*                                                                                    *
*    This program is free software; you can redistribute it and/or                   *
*    modify it under the terms of the GNU Lesser General Public                      *
*    License as published by the Free Software Foundation; either                    *
*    version 2.1 of the License, or (at your option) any later version.              *
*                                                                                    *
*    This program is distributed in the hope that it will be useful,                 *
*    but WITHOUT ANY WARRANTY; without even the implied warranty of                  *
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU                *
*    Lesser General Public License for more details.                                 *
*                                                                                    *
*    You should have received a copy of the GNU Lesser General Public                *
*    License along with this program; if not, write to the Free Software             *
*    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA    *
*                                                                                    *
**************************************************************************************/

#ifndef DefineHeaderCore
#define DefineHeaderCore

#include <GL/gl.h>
#include <GL/glu.h>
#include <string>
#include <vector>
#include <png.h>
#include <SOIL/SOIL.h>

// Simple singleton base class
namespace srl {
    template<class T>
    class Singleton {
    	private:	Singleton(Singleton&);
    				void operator=(Singleton&);
    	protected:	Singleton(){};
    				Singleton(const Singleton<T> &){};
    				~Singleton() { __Delete(); };
    				static T* __SingletonPtr;
    	public:		static T* __Singleton() { if(__SingletonPtr == NULL) __SingletonPtr = new T(); return __SingletonPtr; };
    				static void __Delete() { delete __SingletonPtr; };
    };
    template<class T>
    T* Singleton<T>::__SingletonPtr = 0;
};

#include <SRL/Utils/Vector.h>
#include <SRL/Utils/Matrix.h>
#include <SRL/Engine/Texture.h>
#include <SRL/Engine/FrameBuffer.h>
#include <SRL/Engine/Shader.h>
#include <SRL/Engine/Program.h>
#include <SRL/Utils/Log.h>

#define SRL_DIFFUSE		2
#define SRL_NO_DIFFUSE	4
#define SRL_PARALLAX	8
#define SRL_NO_PARALLAX	16
#define SRL_REPEAT		32
#define	SRL_ONCE		64
#define SRL_SCALE		128
#define SRL_COLOR		256
#define SRL_NO_COLOR	512
#define SRL_NORMAL		1024
#define SRL_NO_NORMAL	2048
#define SRL_LIGHT		4096
#define SRL_NO_LIGHT	8192

namespace srl {

    // Texture Loader
    srl::Texture Load(std::string url, srl::Texture* tex=NULL);
    
    // Transform 3D coord to screen coord
    srl::Vector<float> glToScreen(const srl::Vector<float> &v);
	srl::Vector<float> glToScreen(const float x, const float y, const float z);
	
	// Send a 'standard' uniform to the current program
	void Send(int flags);

	    
};

#endif
